import allure
from airtest.core.api import *

from common.airtest.airtest_base import AirtestBase, exists_1
from common.log.log import log
from config.conf import BASE_DIR


class SystemSettingPage:
    """个人中心-系统设置页面"""

    @allure.step('个人中心-系统设置，打开指定设置')
    def open_setting(self, setting):
        """
        个人中心-系统设置，打开指定设置
        """
        try:
            log.info(f'个人中心-系统设置打开：{setting}')
            element_1 = BASE_DIR + fr"/element_picture/我的/系统设置/{setting}.png"
            AirtestBase().click_5(element_1)
        except Exception as e:
            log.error(f'个人中心-系统设置，打开打开{setting}出现异常为：{e}')
            raise e
